package com.tianqingwl.gsystem.common.enumeration;

import java.util.HashMap;
import java.util.Map;

public enum SearchTypeEnum {
    USER_NAME("1", "账号"),
    SHOW_NAME("2", "姓名"),
    PHONE("3", "手机号"),
    EMAIL("4", "邮箱")
    ;

    private String key;
    private String name;
    private static final Map<String, SearchTypeEnum> map = new HashMap<String, SearchTypeEnum>() {{
        put(USER_NAME.key, USER_NAME);
        put(SHOW_NAME.key, SHOW_NAME);
        put(PHONE.key, PHONE);
        put(EMAIL.key, EMAIL);
    }};

    SearchTypeEnum(String key, String name) {
        this.key = key;
        this.name = name;
    }

    public static SearchTypeEnum getType(String key) {
        return map.get(key);
    }

    public static String getName(String key) {
        return map.get(key).name;
    }
}
